package com.ymatou.iapi.livebuyer.testcase;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;

import org.junit.After;
import org.junit.AfterClass;
import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.Test;
import org.junit.experimental.categories.Category;

import com.google.gson.JsonArray;
import com.ymatou.iapi.livebuyer.parameter.RemoveDirtyWordsBean;
import com.ymatou.iapi.livebuyer.service.RemoveDirtyWordsCall;
import com.ymt.core.tool.Logger;
import com.ymt.utils.annotation.*;
import com.ymt.utils.tag.*;
import com.ymttest.business.service.LiveRoomCallService;
/**
*删除脏字列表
*FreeMaker Template自动生成代码
*/
@TestSuite
public class Ts_RemoveDirtyWords{
	private static RemoveDirtyWordsBean removedirtywordsBean;
	private static RemoveDirtyWordsCall removedirtywordsCall;
	@BeforeClass
	public static void setUp() {
		Logger.createResultFile("删除脏字列表");
	}

	@Before
	public void caseUp() {
		removedirtywordsBean=new RemoveDirtyWordsBean();
		removedirtywordsCall=new RemoveDirtyWordsCall();
	}

	@AfterClass
	public static void tearDown() {
		Logger.generateResult(removedirtywordsCall.getOpurl());
	}

	@After
	public void caseDown() {
		Logger.end();
	}
	@Test
	@Category({P1.class})
	@TestCase
	public void Tc_RemoveDirtyWords_001() {
		Logger.start(true,"删除脏字列表成功");
		try {
			String dword=LiveRoomCallService.QueryDirtyWords().get(0).toString();
			List<String> dirtyWords=Arrays.asList(dword);
			removedirtywordsBean.setDirtyWords(dirtyWords);
			removedirtywordsCall.setData(removedirtywordsBean);
			removedirtywordsCall.callService();			
			Logger.verifyEquals("200", removedirtywordsCall.getString("code"), "验证code");
			JsonArray wordlist = LiveRoomCallService.QueryDirtyWords();
			
		} catch (Exception e) {
			Logger.fail(e);
		}
	}
	@Test
	@Category({P3.class})
	@TestCase
	public void Tc_RemoveDirtyWords_002() {
		Logger.start(true,"不输入dirtyWords失败");
		try {
			removedirtywordsCall.setData(removedirtywordsBean);
			removedirtywordsCall.callService();			
			Logger.verifyEquals("100", removedirtywordsCall.getString("code"), "验证code");
		} catch (Exception e) {
			Logger.fail(e);
		}
	}
}